import axios from "@/utils/request";

export const getGoodsList = (params) => {
  return axios.get("/goods", { params });
};
export const deletetGoods = (id) => {
  return axios.delete(`/goods/${id}`);
};
export const addGoods = (params) => {
  return axios.post("/goods", params);
};
export const getCategories = (params = null) => {
  return axios.get("/categories", { params });
};
export const getAttrs = (id, params = null) => {
  return axios.get(`/categories/${id}/attributes`, { params });
};
export const deleteAttrs = (id, attrid) => {
  return axios.delete(`/categories/${id}/attributes/${attrid}`);
};
export const addAttrs = (id, params = null) => {
  return axios.post(`/categories/${id}/attributes`, params);
};
export const setAttrs = (id, attrid, params = null) => {
  return axios.put(`/categories/${id}/attributes/${attrid}`, params);
};
export const getIdGoods = (id) => {
  return axios.get(`/goods/${id}`);
};
export const setGoods = (id, params = null) => {
  return axios.put(`/goods/${id}`, params);
};
export const deleteClassify = (id) => {
  return axios.delete(`categories/${id}`);
};
export const addClassify = (params) => {
  return axios.post(`categories`, params);
};
export const setClassify = (id, params) => {
  return axios.put(`categories/${id}`, params);
};
